#
#  OSPFv2 test suite Makefile
#

#----------------------------------------------------------- SETUP

VERSION = 0.2.1
TOPDIR = ../../../../../..
include $(TOPDIR)/Makefile.common

JAVAC = javac -classpath $(SSFNET_TEST_CLASSPATH)
JAVA  = java  -classpath $(SSFNET_TEST_CLASSPATH)

# This is for the cygwin environment which has trouble with the mix of
# slashes and backslashes... Take care, that the classpath is set correctly!
ifeq ($(OSTYPE), cygwin)
JAVAC = javac
JAVA  = java
endif

REPORT=report.log
SHARED=./shared
VERDICT=$(SHARED)/verdict.pl
COMPLETE=complete.log

TESTSUITES=1_hello 2_flood 3_lsa 4_route 5_config 6_add

#----------------------------------------------------------- MAKE tests
tests:
	@list='$(TESTSUITES)'; for suite in $$list; do \
	(cd $$suite && $(MAKE))\
	done;
	@$(VERDICT) OSPF-Testsuite $(REPORT) $(TESTSUITES) > $(REPORT)
	@cat $(REPORT)

#----------------------------------------------------------- MAKE report	
report:
	@echo "######## Complete Test Report for ospf.v4.ip ########" > $(COMPLETE)
	@list='$(TESTSUITES)'; for suite in $$list; do \
	(cd $$suite; $(MAKE) report; cd ..; cat $$suite/$(COMPLETE) >> $(COMPLETE))\
	done;
	@cat $(REPORT) >> $(COMPLETE)

#----------------------------------------------------------- MAKE clean
clean:
	rm -f *.log *.tcpdump *.dump *~ *.bak
	rm -f shared/*.bak shared/*~
	@list='$(TESTSUITES)'; for suite in $$list; do \
	(cd $$suite && $(MAKE) clean)\
	done;
